Python v3.7 HowTos:
Accept a filename and print the file extension
Get the path and name of the current file
import os.path open('abc.txt', 'w') print(os.path.isfile('abc.txt'))
Output:
True
See also
https://www.w3resource.com/python-exercises/python-basic-exercise-41.php